//
//  YMFNavigationController.swift
//  FlyingPigeon
//
//  Created by yang on 2019/5/25.
//  Copyright © 2019年 a. All rights reserved.
//

import Foundation
import UIKit

class YMFNavigationController: UINavigationController {
    
    
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        super.pushViewController(viewController, animated: animated)
        
        tabBarController?.tabBar.isHidden = childViewControllers.count > 0 ? true : false
    }
    
    override func popViewController(animated: Bool) -> UIViewController? {
        let vc = super.popViewController(animated: animated)
        tabBarController?.tabBar.isHidden = childViewControllers.count == 1 ? false : true
        
       return vc
    }
    
    override func popToRootViewController(animated: Bool) -> [UIViewController]? {
        tabBarController?.tabBar.isHidden = false
        return super.popToRootViewController(animated: animated)
    }
}

